package com.peak.distribution.manager.agent.impl;

import java.util.List;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.peak.distribution.entity.agent.DisAgentSales;
import com.peak.distribution.manager.agent.DisAgentSalesManager;
import com.peak.spring.boot.builder.repository.FilterParamBuilder;
import com.peak.spring.boot.core.manager.BaseManagerImpl;

@Component
@Transactional(readOnly = true)
public class DisAgentSalesManagerImpl extends BaseManagerImpl<DisAgentSales> implements DisAgentSalesManager {

	@Override
	public DisAgentSales getByAgentId(Integer agentId) {
		return super.findOne("agent.id", agentId);
	}

	@Override
	public List<DisAgentSales> getTeamSalesByAgentId(Integer agentId) {
		return super.findList(FilterParamBuilder.create().eq("team.members.id", agentId).build());
	}

	@Override
	public DisAgentSales getByTeamId(Integer teamId) {
		return super.findOne("team.id", teamId);
	}

}
